package com.dkm.biz.gl.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dkm.base.api.constants.RedisConstants;
import com.dkm.biz.gl.persistence.entity.GlFilterVocabularyPo;
import com.dkm.biz.gl.repository.GlFilterVocabularyRepository;
import com.dkm.biz.gl.service.GlFilterVocabularyService;
import com.dkm.biz.gl.util.word.Node;
import com.dkm.biz.gl.util.word.WordFilterUtil;
@Service
public class GlFilterVocabularyServiceImpl implements GlFilterVocabularyService{
	
	@Resource
	private GlFilterVocabularyRepository glFilterVocabularyRepository;

	@Override
	public void addGlFilterVocabulary() {
		WordFilterUtil.tree= new Node();
		List<GlFilterVocabularyPo> pos=glFilterVocabularyRepository.findAll();
		if(pos!=null){
			Node tree = new Node();
			for(GlFilterVocabularyPo po:pos){
				WordFilterUtil.insertWord(tree,po.getWord(),po.getLevel());
			}
		//	JedisUtil.set("WORD_FILTER_NODE", tree, RedisConstants.SYSTEM);
		}
	}


}
